import './assets/css/normalize.css';
import Vue from 'vue';
import App from './App';
import Router from 'vue-router';
 import abroad from './pages/abroad';
 import domestic from './pages/domestic';
import ax from 'axios';

Vue.use(Router);
ax({
    url: 'http://localhost:9001/data/index',
    method: 'get'
}).then(res => {
    const router = new Router({
        routes: [
            {
                path: '/',
                name: 'domestic',
                component: domestic,
                props: {
                    total: res.data.total,
                    data: res.data.provinces
                }
            },
            {
                path: '/abroad',
                name: 'abroad',
                component: abroad,
                props: {
                    total: res.data.aboardTotal,
                    data: res.data.aboard
                }
            },
            {
                path: '/domestic',
                name: 'domestic1',
                component: domestic,
                props: {
                    total: res.data.total,
                    data: res.data.provinces
                }
            }
        ]
    });
    new Vue({
        el: '#app',
        router,
        render: h => h(App)
    });
});
